<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../Vue.js/vue.js"></script>
</head>
<body>
    <div class="root">
        <h1>你好，{{name}}</h1>
        <button v-on:click = "showInfo">点我有惊喜</button>
        <!-- 占位符，不会弄丢event -->
        <button @click = "showInfo2(66, $event)">点我没有惊喜</button>
    </div>
</body>
<script>
    const vm = new Vue({
        el: ".root",
        data: {
            name: "XCZJust"
        },
        methods: {
            //参数默认有，是事件目标
            showInfo(event){
                //alert("你好");
                //console.log(event.target.innerText)
                console.log(this === vm);
            },
            showInfo2(number){
                alert(number);
            }
        }
    })
</script>
</html>